package com.bnz.order.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bnz.order.entity.TbAddress;
import com.bnz.order.mapper.TbAddressMapper;
import com.bnz.order.service.AddressService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class AddressServiceImpl extends ServiceImpl<TbAddressMapper, TbAddress> implements AddressService {
    @Autowired
    private TbAddressMapper addressMapper;
    // 1. 根据登录名得到收件人的地址信息信息
    @Override
    public List<TbAddress> findAddressList(String name) {
        if (StringUtils.isNotBlank(name)){
            return addressMapper.selectList(new QueryWrapper<TbAddress>().eq("user_id",name));
        }else {
            return new ArrayList<>();
        }

    }
}
